<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!-- swiper 第三方插件 -->
    <!-- 1. 先引入样式和js文件  -->
    <link rel="stylesheet" href="../swiper/swiper-bundle.min.css">
    <script src="../swiper/swiper-bundle.min.js"></script>
    <style>
        .demo {
            width: 1226px;
            height: 400px;
            margin: 50px auto;
            position: relative;
        }


        .demo .dot-list  {
            position: absolute;
            left: 1000px;
            
            bottom: 20px;
            display: flex;

        }

        .dot-list  span {
            width: 10px;
            height: 10px;
            margin: 0 5px;
            border-radius: 50%;
            border: 1px solid #999999;
            background-color: rgba(0, 0, 0, 0.2);
        }

        .dot-list  .active {
            background-color: #fff;
        }

    </style>
</head>

<body>
    <!-- 2. 搭建swiper的html结构   -->
    <!-- 3. 定义定义Swiper容器大小  -->
    <div class="swiper demo">
        <div class="swiper-wrapper">
            <div class="swiper-slide">Slide 1</div>
            <div class="swiper-slide">Slide 2</div>
            <div class="swiper-slide">Slide 3</div>
            <div class="swiper-slide">Slide 4</div>
            <div class="swiper-slide">Slide 5</div>
            <div class="swiper-slide">Slide 6</div>
        </div>
        <!-- 如果需要分页器 -->
        <div class="swiper-pagination"></div>
        <!-- <div class="dot-list"></div> -->

        <!-- 如果需要导航按钮 -->
        <div class="swiper-button-prev"></div>
        <div class="swiper-button-next"></div>

        <!-- 如果需要滚动条 -->
        <!-- <div class="swiper-scrollbar"></div> -->
    </div>
</body>
<script>
    // 4. 初始化Swiper

    // 插件中定义的Swiper 构造函数  => new Swiper()
    // new Swiper(selector,options)
    // selector  传入css选择器  => 需要轮播的swiper容器
    // options   swiper的相关配置(对象  -> 配置有很多)

    var mySwiper = new Swiper('.demo', {
        // direction: 'vertical', // 垂直切换选项(默认水平方向)
        loop: true, // 循环模式选项
        // autoplay:true, // 默认自动播放

        autoplay:{
            delay: 3000,
            stopOnLastSlide: false,  // 滚动到最后一张停止(loo:true => 无效)
            disableOnInteraction: false,    // 用户操作swiper之后，是否禁止autoplay。默认为true：停止。
            pauseOnMouseEnter: true,  // 移入暂停 移出移动
        },

        // 如果需要分页器
        pagination: {
            el: '.swiper-pagination',  // dot的容器名
            // el: '.dot-list',  // dot的容器名
            clickable:true,   // 开启点击切换
            dynamicBullets: true,
        },

        // 如果需要前进后退按钮
        navigation: {
            nextEl: '.swiper-button-next',
            prevEl: '.swiper-button-prev',
        },

        // 如果需要滚动条
        scrollbar: {
            el: '.swiper-scrollbar',
        },
    })

</script>

</html>